Skip to content

London| SDC-Nov-25| Fatma Degirmenci | Sprint 5| Laptop allocation#329

Open
fatmaevin wants to merge 1 commit intoCodeYourFuture:mainfrom
fatmaevin:laptop_allocation
Open

London| SDC-Nov-25| Fatma Degirmenci | Sprint 5| Laptop allocation#329
fatmaevin wants to merge 1 commit intoCodeYourFuture:mainfrom
fatmaevin:laptop_allocation

Conversation

@fatmaevin
Copy link

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

@fatmaevin fatmaevin added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 5 Assigned during Week 5 of this module labels Feb 16, 2026
@illicitonion illicitonion added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Feb 23, 2026

# try all possible laptop combinations
def find_best_allocation(person_index:int,current_total:int,current_allocation: Dict[Person, Laptop],remaining_laptops: List[Laptop]):
nonlocal total, allocation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally avoid nonlocal where-ever possible, because it makes it much harder to reason about code.

Consider instead passing around an object as an argument to this function so it's more clear what's passed where, and what can modify what.

@illicitonion
Copy link
Member

This is looking great, well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. 📅 Sprint 5 Assigned during Week 5 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants